from django.http import HttpResponse#, HttpResponseRedirect, Http404
from django.template.loader import render_to_string
from django.shortcuts import get_object_or_404, render_to_response #redirect
from django.template import RequestContext

from google.appengine.api import users

from coffee_n_code.CoffeeUser.models import User


def main(request):
    return render_to_response('index.html',
                              RequestContext(request,
                                             {'cuser': User.get_current_user(),
                                              'guser': users.get_current_user(),
                                              'login': users.create_login_url(''),
                                              'logout': users.create_logout_url(''),
                                              }))


def login(request):
    return render_to_response('login.html',
                              RequestContext(request,
                                             {'cuser': User.get_current_user(),
                                              'guser': users.get_current_user(),
                                              }))


def register(request):
    return render_to_response('register.html',
                              RequestContext(request,
                                             {'cuser': User.get_current_user(),
                                              'guser': users.get_current_user(),
                                              }))
